package sockets;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.ServerSocket;
import java.net.Socket;
import java.security.SecureRandom;



public class Server 
{
	private static int port=13000,maxConnections=0;


	public static void main(String[] args)
	{
		//Warte auf Anfragen auf Port 13000:
		try{
			ServerSocket listener = new ServerSocket(port);
			Socket server;
			int i=0;

			while((i++ < maxConnections) || (maxConnections == 0)){

				server = listener.accept();
				UserSocketThreaded userThread= new UserSocketThreaded(server);
				Thread t = new Thread(userThread);
				t.start();
				System.out.println("UserThread gestartet");
			}
		} catch (IOException ioe) {
			System.out.println("IOException on socket listen: " + ioe);
			ioe.printStackTrace();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}

	}//end of main

}// end of Server